package com.longer.demo.biz.service;

import com.longer.demo.biz.service.model.ItemModel;
import com.longer.demo.framework.error.BusinessException;

import java.util.List;

public interface ItemService {
	/**
	 * 根据id获取商品
	 * @param id
	 * @return
	 */
	ItemModel getItemById(Integer id);

	/**
	 * 获取商品列表
	 * @return
	 */
	List<ItemModel> getItemList();


	/**
	 * 创建商品
	 * @param itemModel
	 */
	ItemModel createItem(ItemModel itemModel) throws BusinessException;

	/**
	 * 商品购买减库存
	 * @param account
	 * @param itemId
	 * @return
	 * @throws BusinessException
	 */
	boolean minusStock(Integer account,Integer itemId) throws BusinessException ;

	/**
	 * 商品购买之后增加销售量
	 */
	void increaseSales(Integer account,Integer id);
}
